package com.foreknow.demo1;

public class TestMethod {

    public void m1(Person person) {  //person= new PersonImpl()
        person.eat("fender");
    }

    public Person m2(){
        return new PersonImpl();
    }

    public void m3(A a) {
        System.out.println(a.m1());
    }

    public A m4() {
        return new AImpl();
    }

    public static void main(String[] args) {
        TestMethod method = new TestMethod();
        PersonImpl p = new PersonImpl();
        method.m1(p);
        System.out.println("------------m3---------------");
        A a = new AImpl();
        method.m3(a);
        System.out.println("------------m4---------------");
        A aa = method.m4();
        System.out.println(aa.m1());
    }
}
